package com.huayun.components;

import android.view.Gravity;

import com.taobao.weex.WXSDKInstance;
import com.taobao.weex.ui.action.BasicComponentData;
import com.taobao.weex.ui.component.WXComponentProp;
import com.taobao.weex.ui.component.WXInput;
import com.taobao.weex.ui.component.WXVContainer;
import com.taobao.weex.ui.view.WXEditText;

/**
 * Description:
 * Created on 2019/9/2 0002 17:28:18
 * Organization:华云
 * author:AHuangSHang
 */
public class HuayunInput extends WXInput {
    public HuayunInput(WXSDKInstance instance, WXVContainer parent, boolean isLazy, BasicComponentData basicComponentData) {
        super(instance, parent, isLazy, basicComponentData);
    }

    @WXComponentProp(name = "gravity")
    public void setGravity(String gravity) {
        switch (gravity) {
            case "left":
                ((WXEditText) getHostView()).setGravity(Gravity.START);
                break;
            case "right":
                ((WXEditText) getHostView()).setGravity(Gravity.END);
                break;
            case "center":
                ((WXEditText) getHostView()).setGravity(Gravity.CENTER);
                break;

        }
    }
}
